package utils;


import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.junit.Before;
import org.junit.Test;

import java.util.*;

/**
 * @author zxs
 * @create 2021-03-30 16:43
 */
public class CollectionTest {
    List<Integer> nums1=new ArrayList<Integer>();
    List<Integer> nums2=new ArrayList<Integer>();

    @Before
    public void builder() {
        nums1.addAll(Arrays.asList(new Integer[]{1, 2, 3,4,4}));
        nums2.addAll(Arrays.asList(new Integer[]{3,3, 4, 5, 6}));
    }

    @Test
    public void test1() {
        System.out.println(nums1.retainAll(nums2));
        System.out.println(nums1);
    }

    @Test
    public void test2() {

        System.out.println(CollectionUtils.subtract(nums1, nums2));
        System.out.println(CollectionUtils.disjunction(nums1, nums2));
        System.out.println(CollectionUtils.intersection(nums1, nums2));
        System.out.println(CollectionUtils.union(nums1, nums2));
    }

    @Test
    public void test3() {

    }
}
